package com.xiaochong.bitong.api.webWs;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * @Project : xc-tir
 * @Package Name : com.xiaochong.tir.api.webws
 * @Description : TODO
 * @Author : daizhiqing@xiaochong.com
 * @Creation Date : 2018年05月30日上午10:58
 * @ModificationHistory Who When What
 */
@Configuration
@Component
public class WebSocketConfig implements ApplicationContextAware {
    public static ApplicationContext appContext;

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

    // 目前通过此种方式获取注入的spring bean
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        // TODO Auto-generated method stub
        appContext = applicationContext;
    }

}
